﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Microsoft.VisualBasic;

namespace SalePartial.Model
{

    public class XPNewsCateGoryInfo
    {
        // Methods
        public XPNewsCateGoryInfo()
        {
            this._CaID = Guid.NewGuid();
            this._CaName = string.Empty;
            this._CreateDate = DateTime.Now;
            this._CreateTime = DateTime.Now;
            this._CreateUserID = Guid.Empty;
            this._Attachment = string.Empty;
        }
        public XPNewsCateGoryInfo(SqlDataReader reader)
        {
            this._CaID = Guid.NewGuid();
            this._CaName = string.Empty;
            this._CreateDate = DateTime.Now;
            this._CreateTime = DateTime.Now;
            this._CreateUserID = Guid.Empty;
            this._Attachment = string.Empty;
            
            this.LoadFromReader(reader);
        }
        
        protected void LoadFromReader(SqlDataReader reader)
        {
            if ((!Information.IsNothing(reader) && !reader.IsClosed))
            {
                this._CaID = reader.GetGuid(0);
                this._CaName = reader.GetString(1);
                
                if (!reader.IsDBNull(2))
                {
                    this._CreateDate = reader.GetDateTime(2);
                }

                if (!reader.IsDBNull(3))
                {
                    this._CreateDate = reader.GetDateTime(3);
                }

                if (!reader.IsDBNull(4))
                {
                    this._CreateUserID = reader.GetGuid(4);
                }
                if (!reader.IsDBNull(5))
                {
                    this._Attachment = reader.GetString(5);
                }
                
            }
        }

        // Properties
        public Guid CaID
        {
            get { return this._CaID ; }
            set { this._CaID = value; }
        }

        public string CaName
        {
            get { return this._CaName; }
            set { this._CaName = value; }
        }
        
        public DateTime CreateDate
        {
            get { return this._CreateDate; }
            set { this._CreateDate = value; }
        }

        public DateTime CreateTime
        {
            get { return this._CreateTime; }
            set { this._CreateTime = value; }
        }

        public Guid CreateUserID
        {
            get { return this._CreateUserID; }
            set { this._CreateUserID = value; }
        }


        public string Attachment
        {
            get { return this._Attachment; }
            set { this._Attachment = value; }
        }

        // Fields
        private Guid _CaID;
        private string _CaName;
        private DateTime _CreateDate;
        private DateTime _CreateTime;
        private Guid _CreateUserID;
        private string _Attachment;
    }


}
